package com.my.hotel.service.impl;

import com.my.hotel.entity.Eva;
import com.my.hotel.entity.EvaReply;
import com.my.hotel.mapper.EvaMapper;
import com.my.hotel.mapper.EvaReplyMapper;
import com.my.hotel.service.EvaService;
import com.my.hotel.service.OrderService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class EvaServiceImpl implements EvaService {
    @Autowired
    private EvaMapper evaMapper;
    @Autowired
    private OrderService orderService;
    @Autowired
    private EvaReplyMapper evaReplyMapper;

    @Transactional
    public void addEva(Eva eva) {
        evaMapper.addEva(eva);
        int id = eva.getId();
        evaMapper.addEvaImage(String.valueOf(id),eva.getImageUrl());
        orderService.updEvaStatus("1",eva.getOrderId());
    }

    public  void addEvaImage( String evaId, String imageUrl){
        evaMapper.addEvaImage(evaId,imageUrl);
    };
    public List<Eva> eva_all() {
        return evaMapper.eva_all();
    }

    public List<Eva> eva_pj(List list) {
        return evaMapper.eva_pj(list);
    }

    public List<Eva> eva_rm_px(List ids) {
        return evaMapper.eva_rm_px(ids);
    }

    public int eva_hzc_num(List ids) {
        return evaMapper.eva_hzc_num(ids);
    }

    public void eva_reply(EvaReply evaReply) {
        evaReplyMapper.eva_reply(evaReply);
    }

    public List<EvaReply> selectEvaReplyByEvaId(long evaId) {
        return evaReplyMapper.selectEvaReplyByEvaId(evaId);
    }

    public int eva_dz_num(String id) {
        return evaMapper.eva_dz_num(id);
    }

    public Eva eva_Id(String id) {
        return evaMapper.eva_Id(id);
    }

}
